home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / fsio / fsioLock.h < prev    next >
C/C++ Source or Header  |  1990-10-10  |  2KB  |  60 lines

  1. /*
  2.  * fsioLock.h --
  3.  *
  4.  *    Declarations for user-level file locking routines.
  5.  *
  6.  * Copyright 1987 Regents of the University of California
  7.  * All rights reserved.
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software and its documentation for any purpose and without
  10.  * fee is hereby granted, provided that the above copyright
  11.  * notice appear in all copies.  The University of California
  12.  * makes no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without
  14.  * express or implied warranty.
  15.  *
  16.  * $Header: /sprite/src/kernel/fsio/RCS/fsioLock.h,v 9.1 90/10/08 15:54:11 mendel Exp $ SPRITE (Berkeley)
  17.  */
  18.  
  19. #ifndef _FSLOCK
  20. #define _FSLOCK
  21. /*
  22.  * There is a system call to lock a file.  The lock state is kept in
  23.  * the I/O handle on the I/O server so that the lock has network-wide effect.
  24.  */
  25.  
  26. typedef struct Fsio_LockState {
  27.     int        flags;        /* Bits defined below */
  28.     List_Links    waitList;    /* List of processes to wakeup when the
  29.                  * file gets unlocked */
  30.     int        numShared;    /* Number of shared lock holders */
  31.     List_Links    ownerList;    /* List of processes responsible for locks */
  32. } Fsio_LockState;
  33.  
  34. /*
  35.  * (The following lock bits are defined in user/fs.h)
  36.  * IOC_LOCK_EXCLUSIVE - only one process may hold an exclusive lock.
  37.  * IOC_LOCK_SHARED    - many processes may hold shared locks as long as
  38.  *    there are no exclusive locks held.  Exclusive locks have to
  39.  *    wait until all shared locks go away.
  40.  */
  41.  
  42. /*
  43.  * flock() support
  44.  */
  45. extern void Fsio_LockInit _ARGS_((Fsio_LockState *lockPtr));
  46. extern ReturnStatus Fsio_IocLock _ARGS_((Fsio_LockState *lockPtr, 
  47.             Fs_IOCParam *ioctlPtr, Fs_FileID *streamIDPtr));
  48. extern ReturnStatus Fsio_Lock _ARGS_((Fsio_LockState *lockPtr, 
  49.             Ioc_LockArgs *argPtr, Fs_FileID *streamIDPtr));
  50. extern ReturnStatus Fsio_Unlock _ARGS_((Fsio_LockState *lockPtr, 
  51.             Ioc_LockArgs *argPtr, Fs_FileID *streamIDPtr));
  52. extern void Fsio_LockClose _ARGS_((Fsio_LockState *lockPtr,
  53.             Fs_FileID *streamIDPtr));
  54. extern void Fsio_LockClientKill _ARGS_((Fsio_LockState *lockPtr, int clientID));
  55.  
  56. /*
  57.  * Cache consistency routines.
  58.  */
  59. #endif _FSLOCK
  60.